<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
   <title>My JSP 'list_manager.jsp' starting page</title>
   <meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="<c:url value="/css/application.css"></c:url>">
    <link rel="stylesheet" type="text/css" href="<c:url value="/css/listdata.css"></c:url>">
    <link rel="stylesheet" type="text/css" href="<c:url value="/css/form.css"></c:url>">
    
    <script type="text/javascript" src="<c:url value="/js/common.js"/>"></script>
    
    <script type="text/javascript">

         
         function update(loginId)
         {
               location.href="<c:url value="/managerMgr?act=get_id"/>&loginId="+loginId;
            
         }  
         
         function freeze(loginId)
         {
             if(confirm("确认要冻结管理帐号["+loginId+"]吗?"))
             {
              location.href="<c:url value="/managerMgr?act=freeze"/>&loginId="+loginId;
             }
         }
         
         function defreeze(loginId)
         {
             if(confirm("确认要解冻已被禁止登陆的管理帐号["+loginId+"]吗?"))
             {
               location.href="<c:url value="/managerMgr?act=defreeze"/>&loginId="+loginId;
             }
         }         


    
        function remove(loginId)
         {
             if(confirm("确认要删除管理帐号["+loginId+"]吗?"))
             {
               location.href="<c:url value="/managerMgr?act=dele"/>&loginId="+loginId;
             }
         }   
  
        function doQuery(pageno)
         {
            if(pageno<1 || pageno>${page.totalPageNum})
            {
              alert("页号超出范围，有效范围：[1-${page.totalPageNum}]!");
              ${'pageNo'}.select();
              return;
            }
            
            var f=document.forms[0];
            f.action=f.action+"&pageNo="+pageno;
            f.submit();
            
         }
         
         function PriceSequence(type){
            var p = document.forms[0];
            p.action=p.action+"?PriceSequence="+type;
            p.submit();
         
         }
     
                 
    
    </script>
  </head>
  
 <body>
     <div class="listTitle"> 
      >> 管理员列表
     </div>
     <c:if test="${not empty page.pageContent}">
   <form action="<c:url value="/managerMgr?act=loadManagers"/>" method="post">
     <div style="margin:5px; padding=3px">
     管理者账户:  <input type="text" class="text" name="qryManagerId"   value="${param['qryManagerId']}"/ > &nbsp;
     
      管理者名字:  <input type="text" class="text" name="qryManagerName" value="${param['qryManagerName']}"/> &nbsp;
       <input type="submit" value="查询"/>
     </div>
   </form>
	     <table class="listable" cellspacing=0 cellpadding=0 border=0>
		      <thead>
		         <tr>
		           <th>管理员账号</th>
		           <th>管理员姓名</th> 
		           <th>当前状态</th>
		           <th>相关操作</th>        
		         </tr>
		      </thead>
		      <tbody>
		         <c:forEach var="manager" items="${page.pageContent}">
		            <tr>
		              <td>${manager.loginId}</td>
		              <td>${manager.realName}</td>
		              <td>${manager.status}</td>
		              <td>
		                <span title="点击修改[${manager.loginId}]管理帐号信息" class="linkSpan" onclick="update('${manager.loginId}');">修 改</span> &nbsp;
		                <span title="点击删除[${manager.loginId}]管理帐号信息" class="linkSpan" onclick="remove('${manager.loginId}');">删 除</span>&nbsp;
		                <c:if test="${manager.status=='正常使用'}">
		                <span title="点击冻结[${manager.loginId}]管理帐号" class="linkSpan" onclick="freeze('${manager.loginId}');">冻结</span>
		                </c:if>
		                <c:if test="${manager.status=='冻结停用'}">
		                <span title="点击解冻[${manager.loginId}]管理帐号" class="linkSpan" onclick="defreeze('${manager.loginId}');">解冻</span>
		                </c:if>		               
		              </td>	              	              	              	              
		            </tr>
		         </c:forEach>
		      </tbody>
		  </table>
	             <div id="pageinfo" style="float:right; margin:5px; padding-right:3px;">
		            共${page.totalRecNum}条, 当前显示${page.startIndex+1}-${page.endIndex}条, 第${page.pageNo}/${page.totalPageNum}页
		           |
		           <c:if test="${page.pageNo>1}">
		             <span class="linkspan" onclick="doQuery(1)">首页</span>&nbsp;
		           </c:if>
		           <c:if test="${page.prePage}">
		             <span class="linkspan" onclick="doQuery(${page.pageNo-1})">上一页</span>&nbsp;
		           </c:if>
		           <c:if test="${page.nextPage}">
		             <span class="linkspan" onclick="doQuery(${page.pageNo+1})">下一页</span>&nbsp;
		           </c:if>
		           <c:if test="${page.pageNo!=page.totalPageNum}">
		             <span class="linkspan" onclick="doQuery(${page.totalPageNum})">末页</span>&nbsp;
		           </c:if>
		           |
		            到<input type="text" id="pageNo" size=4 style="text-align:right;" onkeypress="onlynumber();"/> 页
		           <button onclick="doQuery($('pageNo').value);"> 跳 转 </button>		           		           	           	              
		        </div>
	     </div>  
    </c:if>
	<c:if test="${empty page.pageContent}">
       <center>
        <div id="noRecord" style="margin-top:80px;width:30%;height:70px;border:1px solid #c1cdd8;text-align:center;">
          <span style="margin-top:20px;color:red;">没有符合条件的管理员被找到!</span>
          <br/>
          <br/>
          <button onclick="history.go(-1);"> 返 回 </button>
        </div>
       </center>
     </c:if> 
     
     <c:if test="${not empty errMsg}">
      <script type="text/javascript">
        alert('${errMsg}');
      </script>
       <c:remove var="errMsg"/>
     </c:if>
  </body>
</html>
